import { http } from "@/utils/http";
import { baseUrlApi } from "@/api/utils";
type Result = {
  current_page: number;
  result?: any;
  per_page?: number;
  total?: number;
  data?: any;
};
type ResultDelete = {
  code: number;
  msg: string;
};
type ResultCreate = {
  code: number;
  msg: string;
};
/** 用户列表 */
export const getRoleList = (params?: object) => {
  return http.request<Result>("get", baseUrlApi + "/dashboard/rbacRole/list", {
    params
  });
};

/** 添加*/
export const create = (data?: object) => {
  return http.request<ResultCreate>("post", baseUrlApi + "/rbac-role/store", {
    data
  });
};
/** 修改 */
export const update = (data?: object) => {
  return http.request<ResultCreate>("put", baseUrlApi + "/rbac-role/update", {
    data
  });
};
export const del = (params?: object) => {
  return http.request<ResultDelete>(
    "delete",
    baseUrlApi + "/rbac-role/delete",
    {
      params
    }
  );
};
type Show = {
  code: number;
  msg: string;
  result?: any;
};
/** 角色详情 */
export const getRoleShow = (params?: object) => {
  return http.request<Show>("get", baseUrlApi + "/rbac-role/show", {
    params
  });
};
